﻿<!DOCTYPE html>
<html>
<head>
    <title>CGI</title>
</head>
<body>
    <h1>Our Page</h1>
    <script>
        //01
        //updatedBlog & blog are point to same object in memory

        var blog = {
            name: 'CGI'
        };
        var updatedBlog = blog;
        console.log(updatedBlog.name);


        //02
        //updating blog is same as updating updatedBlog
        /*
        var blog = {
            name: 'CGI Banglore'
        };
        var updatedBlog = blog;
        blog.name = 'CGI Hyderabad';
        console.log(updatedBlog.name);
        */

        //03
        //function can also modify reference type
        /*
        var blog = {
            name: 'CGI'
        };
        function changeBlogName(localBlog) {
            localBlog.name = 'CGI Hyderabad';
        }

        changeBlogName(blog);
        console.log(blog.name);
        */

        //04
        /*
        var a1 = [1, 2, 3];
        var a2 = a1;
        a1[0] = 99;
        console.log(a2[0]);
        */
    </script>
</body>
</html>